#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
void Add(float a, float b)
{
	printf("%.2f\n", a + b);
}
void sup(float a, float b)
{
	printf("%.2f\n", a - b);
}
void Mul(float a, float b)
{
	printf("%.2f\n", a * b);
}
void div(float a, float b)
{
	if (0 == b)

		printf("无解\n");
	else
		printf("%.2f", a / b);
}
void menu()
{
	printf("********************************\n");
	printf("***********简易计算器***********\n");
	printf("********************************\n");
	printf("***********1.加法***************\n");
	printf("***********2.减法***************\n");
	printf("***********3.乘法***************\n");
	printf("***********4.除法***************\n");
	printf("***********0.退出***************\n");
	printf("********************************\n");
}
void Calculator()
{
	int n;
	float a, b;
	menu();
	do
	{
		printf("请选择");
		scanf("%d", &n);
		switch (n)
		{
		case 1:
			printf("请输入两个数");
			scanf("%f%f", &a, &b);
			Add(a, b);
			break;
		case 2:
			printf("请输入两个数");
			scanf("%f%f", &a, &b);
			sup(a, b);
			break;
		case 3:
			printf("请输入两个数");
			scanf("%f%f", &a, &b);
			Mul(a, b);
			break;
		case 4:
			printf("请输入两个数");
			scanf("%f%f", &a, &b);
			div(a, b);
			break;
		case 0:
			printf("退出\n");
			break;
		default:
			printf("选择错误,请重新选择!");
		}
	} while (n);
}
int main(void)
{
	Calculator();
	return 0;
}